home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
VISUALBA
/
PROG914.ZIP
/
PROGRAM.DOC
< prev
next >
Wrap
Text File
|
1994-01-27
|
56KB
|
1,324 lines
PROGRAM.DOC by: Ira F. Kavaler - March & April, 1987
Version 9.14 - 1/27/94
The BASIC Language PROGRAM Generator.
-------------------------------------
I love teaching technical subjects, but I'm not a teacher. I'm an
electrical engineer by trade. While receiving my higher education I
despised computers. I was a radio man; a "ham" (amateur radio)
operator. Based on these early tendencies my first block of technical
training after high school came from RCA Institutes in New York City.
At RCA I took their Advanced Technologies course (T-3) which consisted
of nine terms; the first eight were straight forward Mathematics
(Calculus), English, Science (Physics), Industrial Engineering, and
Electrical and Electronic Theory. The ninth, and last, term was
specialization in either Communications Technology or Computer Science.
Of course, I elected communications! I and my classmates called the
computer kids, "button pushers"!
After graduating from RCA I decided to get my EE degree, so I went
to The Polytechnic Institute of Brooklyn, now masquerading as The
Polytechnic University of New York.
In 1963, while attending Poly, I happened into my public library
one day and, for lack of something better to read, I checked-out a book
on computer programming in machine language. The book was in the RCA
Tutor Series, which was supposed to be a self-learning text; and it
was!
Within days I was writing machine language program for a computer
I didn't even have access to. I was converted to a "button pusher".
The next semester I enrolled in computer classes; Poly had a total of
two: Computer Techniques and Mathematical Techniques; the latter had
very little to do with programming. The language taught was Fortran
IV, and I was writing programs within a day. My professor couldn't
follow the subject matter, complexity, nor logic of my programs by the
second week.
As a class project, I proved by computer simulation that broadcast
color television standards set in the 1950's were wrong; the
modulation compression limits established by the broadcast industry and
the FCC were incorrect.
A second class project was a business inventory and ordering
program for my family's paint business.
By the next semester (1964) my guidance counselor realized my
potential (after "being hit over the head with pleas for computer
time"), so he got me a National Science Foundation grant, and
sponsorship by NASA to do computer programming research. My primary
project was to develop a program to digest vacuum tube and transistor
specifications and characteristic curves for the design of electronic
circuits. I was very successful, having been offered positions by many
large computer companies upon graduation.
I was given access to the newly installed IBM 7040 System, and
time sharing system connected to the GE Datanet, using Darthmouth
BASIC, FORTRAN and ALGOL languages. When Poly replaced the 7040 System
with a new System / 360, I wrote many of the library functions for its
APL (Inversion) language.
While still a student at Poly I started teaching computer
programming classes in additional to the advanced communications
technologies classes I was conducting. I was so successful in getting
other students interested in computer programming that I started
teaching programming to pre-teenagers in my neighborhood.
Upon graduation my family did not was me to move out of New York
City, so I turned down a very lucrative offer by IBM and got a job with
the government; my mother wanted me to have a secure job, and she was
right!
I was always striving to discover the perfect teaching method;
something I'm still trying to do. My teaching techniques progressed to
the point that I could teach a person to write a simple program within
one hour using the six primitive BASIC commands: LET, INPUT, PRINT,
GOTO, IF...THEN, and END.
When I finally got my first home computer* in 1979 (and I resisted
getting one for many years) I was on my way to unlimited computer time.
A couple of years later my boss arranged to get me an IBM XT system.
(* My first machine was a Super Elf 1802 microprocessor on a
single board, followed months later by a TRS-80 Model I, which I still
have in perfect operating condition, amongst other early computer
systems I've been collecting over the years.)
I tough an interesting project would be to write a program that
would allow non-programmers to write fully functional BASIC language
programs with extremely minimal training. To that goal I wrote the
program "PROGRAM", which in 1987 was called simply "PGM".
Some terms I used.
------------------
I tried to explain each of the selections in the two menus:
Instruction and Action. At one point I was stumped! How do I describe
altering the processing path to go back to an earlier point on the
program, or to jump ahead to a later point in the program? I decided
to call the point, either earlier or later, in the program a
"signpost"; it identifies a referenced line number. To identify the
point you erect a signpost.
The term I used to go to the signpost was "detour". When writing
a program you will usually decide to detour to a signpost that has not
been erected yet. That's OK, PROGRAM will ask for an inscription
(label) for that signpost, and use that inscription until it determines
the actual location of the signpost. If you happen to erect the
signpost first, the inscription is still used when any detours to that
signpost are encountered.
Let's try to write a program in BASIC using PROGRAM.
----------------------------------------------------
One of the problem I like to teach as a programming example is the
calculation of the amount of wallpaper required for a room. Having
worked in the paint industry for fifteen years while going to school, I
have discovered the vast majority of people do not know how to
determine how much area a single roll of wallpaper will cover. The
following program development will yield a stand alone BASIC program to
solve this problem.
First read the other documentation file supplied with this
package. It contains the problem broken down into a series of simple
steps. From these simple steps you can draw a simple flow chart that
will diagram these steps. The diagram should look similar to the
following:
┌─────────┐
I have drawn this with │ START │ No command required
only rectangles as └────┬────┘
limited by my word │
processor and printer. ┌──────┴──────┐
│ ASK WIDTH │ Call it W
│ INPUT W │
└──────┬──────┘
│
┌──────┴───────┐
│ ASK LENGTH │ Call it L
│ INPUT L │
└──────┬───────┘
│
┌───────────┴───────────┐
│ CALCULATE PERIMETER │ Call it P
│ P=2*L+2*W │
└───────────┬───────────┘
│
┌──────┴───────┐
│ ASK HEIGHT │ Call it H
│ INPUT H │
└──────┬───────┘
│
┌────────┴─────────┐
│ CALCULATE AREA │ Call it A
│ A=P*H │
└────────┬─────────┘
│
┌─────────┴─────────┐
│ CALCULATE │ The gov't requires
│ NUMBER OF ROLLS │ 30 sq.ft. of paper
│ N=A/30